#!/bin/bash
HERE=$(cd "$(dirname "$0")";pwd)

export PATH="${HERE}"/usr/bin/:"${PATH}"
export LD_LIBRARY_PATH="$HERE"/usr/lib:"$HERE"/usr/lib/i386-linux-gnu:"$HERE"/usr/lib/i386-linux-gnu/deepin-wine:$LD_LIBRARY_PATH
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_SCHEMA_DIR}"
export WINEDEBUG=-all
export WINELOADER="${HERE}"/usr/lib/deepin-wine/wine

mkdir -p /tmp/.deepin-qq-temp
$HERE/usr/bin/unionfs-fuse -o use_ino,nonempty,uid=$UID $HERE/usr/lib/=RO:/usr/lib/=RO  /tmp/.deepin-qq-temp


function finish {
  echo "Cleaning up"
  killall $HERE/usr/bin/unionfs-fuse
}
trap finish EXIT

export WINEPREFIX="$RW_DATADIR"
#"$HERE"/proot-115 -b "$HERE"/usr/lib/i386-linux-gnu/deepin-wine:/usr/lib/i386-linux-gnu/deepin-wine "${HERE}"/usr/lib/deepin-wine/wine "c:\\Program Files\\Tencent\\QQ\\Bin\\QQ.exe" "$@"
"$HERE"/proot-130 -b /tmp/.deepin-qq-temp:/usr/lib/ "${HERE}"/usr/lib/deepin-wine/wine "c:\\Program Files\\Tencent\\QQ\\Bin\\QQ.exe" "$@"
while pgrep "QQ.exe" > /dev/null ; do sleep 5 ; echo "Waiting A" ; done
while pgrep "QQ.exe" > /dev/null ; do sleep 5 ; echo "Waiting B" ; done
	
